#include <jni.h>
#include <string>

#include <ExtQtShare_global.h>
#include <extqtshare.h>
#include "android/log.h"

#define LOGD(TAG, ...) __android_log_print(ANDROID_LOG_DEBUG,TAG ,__VA_ARGS__)
#define LOGI(TAG, ...) __android_log_print(ANDROID_LOG_INFO,TAG ,__VA_ARGS__)
#define LOGW(TAG, ...) __android_log_print(ANDROID_LOG_WARN,TAG ,__VA_ARGS__)
#define LOGE(TAG, ...) __android_log_print(ANDROID_LOG_ERROR,TAG ,__VA_ARGS__)
#define LOGF(TAG, ...) __android_log_print(ANDROID_LOG_FATAL,TAG ,__VA_ARGS__)

#define TAG "native-lib" // 这个是自定义的LOG的标识

void callback(int cnt) {

}

extern "C" JNIEXPORT jstring JNICALL
Java_top_bztech_useqtlib_MainActivity_stringFromJNI(
        JNIEnv* env,
        jobject /* this */) {
    std::string hello = "Hello JNI";
    return env->NewStringUTF(hello.c_str());
}
extern "C" JNIEXPORT void JNICALL
Java_top_bztech_useqtlib_MainActivity_initShareLib(
        JNIEnv* env,
        jobject /* this */) {
    ExtQtShare *shareLib = new ExtQtShare;
    shareLib->init();
    shareLib->registerCountChangedCallBack([=](int cnt){
        LOGI(TAG, "In native-lib callback function, cnt=%d", cnt);
    });
}